﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LevelEditor.LERes
{
    public partial class NewMapUI : Form
    {
        private LevelEditor frmLE;
        public NewMapUI()
        {
            InitializeComponent();
        }

        public NewMapUI(LevelEditor leObj)
        {
            InitializeComponent();
            frmLE = leObj;
        }


        private void NewMap_Load(object sender, EventArgs e)
        {
            // We should handle if user is working with map. And he want to create another one
            // We have 2 choice:
            // 1. Close the previous map and create new one
            // 2. Support tab menu for multi map editor

            // Do nothing right now

            

        }


        /// <summary>
        /// Reset all data in text box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReset_Click(object sender, EventArgs e)
        {         
            txtTileSize.Text = "";
            txtWidth.Text = "";
            txtHeight.Text = "";
        }
        // End btnReset_Click()


        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            string sTileSize = txtTileSize.Text.Trim();
            string sWidth = txtWidth.Text.Trim(); // width mean number of col in map
            string sHeight = txtHeight.Text.Trim(); // height mean number of row in map

            int tileSize = int.Parse(sTileSize);
            int width = int.Parse(sWidth);
            int height = int.Parse(sHeight);

            if (sTileSize.Length == 0 || sWidth.Length == 0 || sHeight.Length == 0)
            {
                MessageBox.Show("Please check your input data");
            }
            else
            {
                // Should we pre-process before pass data ?
                // Do nothing right now
                frmLE.GetData(tileSize, width, height);

            }
        }
        // End btnOK_Click()


    }
}
